import { createRouter, createWebHashHistory, RouteRecordRaw } from "vue-router";
import Home from "../views/home.vue";

const routes: RouteRecordRaw[] = [
  {
    path: "/",
    redirect: "/login",
  },
  {
    path: "/",
    name: "Home",
    component: Home,
    children: [
      {
        path: "/home",
        meta: {
          title: "首页",
        },
        component: () => import("../views/index.vue"),
      },
      {
        path: "/table",
        meta: {
          title: "文案创作",
        },
        component: () => import("../views/table.vue"),
      },
      {
        path: "/person",
        meta: {
          title: "达人分销",
        },
        component: () => import("../views/donate.vue"),
      },
      {
        path: "/channel",
        meta: {
          title: "渠道概览",
        },
        component: () => import("../views/channel/dashboard.vue"),
      },
      {
        path: "/video",
        meta: {
          title: "直播助手",
        },
        component: () => import("../views/channel/video.vue"),
      },
      {
        path: "/product",
        meta: {
          title: "产品创新",
        },
        component: () => import("../views/product/index.vue"),
      },
      {
        path: "/vi",
        meta: {
          title: "包装设计",
        },
        component: () => import("../views/vi/index.vue"),
      },
      {
        path: "/draw",
        meta: {
          title: "自由画",
        },
        component: () => import("../views/vi/draw.vue"),
      },
      {
        path: "/devise",
        meta: {
          title: "营销策略",
        },
        component: () => import("../views/YinXiaoCeLue/yinXiaoCeLue.vue"),
      },
      {
        path: "/user",
        meta: {
          title: "个人中心",
        },
        component: () => import("../views/user.vue"),
      },
      {
        path: "/knowledge",
        meta: {
          title: "知识库",
        },
        component: () => import("../views/knowledge/index.vue"),
      },
      {
        path: "/market",
        meta: {
          title: "市场洞察",
        },
        component: () => import("../views/market/index.vue"),
      },
      {
        path: "/market/product",
        meta: {
          title: "商品大盘",
        },
        component: () => import("../views/market/product.vue"),
      },
      {
        path: "/market/lightning",
        meta: {
          title: "闪电增长",
        },
        component: () => import("../views/market/lightning.vue"),
      },
      {
        path: "/agent",
        meta: {
          title: "营销Agent",
        },
        component: () => import("../views/agent/index.vue"),
      },
    ],
  },
  {
    path: "/login",
    meta: {
      title: "登录",
    },
    component: () => import("../views/login.vue"),
  },
  {
    path: "/403",
    meta: {
      title: "没有权限",
    },
    component: () => import("../views/403.vue"),
  },
];

const router = createRouter({
  history: createWebHashHistory(),
  routes,
});

export default router;
